package com.heima.wemedia.controller.v1;

import com.heima.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmUser;
import com.heima.wemedia.service.WmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/wemedia/user")
public class WmUserController {

    @Autowired
    private WmUserService wmUserService;

    @PostMapping("save")
    public ResponseResult saveWmUser(@RequestBody WmUser wmUser) {
        return ResponseResult.okResult(wmUserService.save(wmUser));
    }

    /**
     * 根据文章id查询作者信息
     * @param articleId
     * @return
     */
    /*@RequestMapping("/findByNewsId")
    public ResponseResult<WmUser> findByNewsId(@RequestBody Long articleId){
        WmUser byNewsId = wmUserService.findByNewsId(articleId);
        return ResponseResult.okResult(byNewsId);
    } */

}
